﻿<%@ Page Title="Home" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="list.aspx.vb" Inherits="LondonItalianRestaurants.list" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div style="float:left; width: 347px;";>
     <h1>Italian Restaurants</h1></div>

      <div style="float:right; width: 252px;";><asp:TextBox ID="tb_TagSearch" runat="server" ></asp:TextBox>
    <asp:Button ID="btn_TagSearch" runat="server" Text="Search Tag" />
     <br />
     Select Tag below To View</div>
     <br /><br />
      <br />
      <br /><div id="GridScroll" class="grid_scroll">
     

      <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
    
    <ItemTemplate>
    
    <a href="list.aspx?TagName=<%#Eval("TagName") %>">
    <%#Eval("TagName") %>
    </a> 
    <hr />
    </ItemTemplate>
    </asp:Repeater></div>
   
    
    


    <div class="restaurants">
        <br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
    DataKeyNames="ID" DataSourceID="SqlDataSource3" AllowPaging="True" 
            AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="None" 
            PageSize="5" BackColor="#99CCFF">
            <AlternatingRowStyle BackColor="#FF9966"/>
            <Columns>
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
            ReadOnly="True" SortExpression="ID" />
                <asp:HyperLinkField DataNavigateUrlFields="ID" 
            DataNavigateUrlFormatString="Details.aspx?ID={0}" 
            DataTextField="RestaurantName" HeaderText="RestaurantName" SortExpression="RestaurantName" />
                <asp:TemplateField HeaderText="MichelinStars" SortExpression="MichelinStars">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("MichelinStars") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <b>
                        <asp:Label ID="Label1" runat="server" ForeColor="blue" Font-Size="X-Large"  Text='<%# ShowStars(Eval("MichelinStars")) %>'></asp:Label>
                        </b>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:ImageField DataImageUrlField="RestaurantPicture" HeaderText="Thumbnail">
                    <ControlStyle CssClass="RestaurantPicture" Width="200px" Height="200px" />
                </asp:ImageField>
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" 
        HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" 
        ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
    
        SelectCommand="SELECT [ID], [RestaurantName], [MichelinStars], [RestaurantPicture], [RestaurantAddress] FROM [Restaurants]">
        </asp:SqlDataSource>
        <br />
        <br />
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
    
        
        SelectCommand="SELECT [ID], [RestaurantName], [TagName], [RestaurantAddress], [AveragePrice], [Website], [MichelinStars], [RestaurantPicture] FROM [TagRestaurantView] WHERE ([TagName] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="TagName" QueryStringField="TagName" 
            Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <br />
        <br />
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
        SelectCommand="SELECT [TagName] FROM [Tags]"></asp:SqlDataSource>
   </div>
</asp:Content>
